<?php

class SurveysController extends AppController
{
	var $name = 'Surveys';
	//var $scaffold;
	
	var $uses = array('Client','Item', 'Survey');
	
	function view($survey_id)
	{
		//$survey_id = 2;
		/*
		$current_survey = $this->Survey->findById($survey_id);
		
		$this->set(compact('current_survey'));
		*/
		$this->set('current_survey', $this->Survey->findById($survey_id));
		
		$items = $this->Item->findAllBySurveyId($survey_id);
		
		$this->set(compact('items'));
	}
	
	function add($client_id)
	{
		$this->set('client_id', $client_id);
	}
	
	function add_survey()
	{
     $this->Survey->save($this->data);
	 $this->redirect(array('controller'=>'clients', 'action'=>'view'));
     exit();
	}
}

?>